package edu.neu.cs6515.farm;

import java.io.IOException;

import edu.neu.cs6515.net.Client;
import edu.neu.cs6515.net.Server;
import edu.neu.cs6515.player.Player;
import edu.neu.cs6515.player.strategy.LowestColorFirstStrategy;

public class ClientServerFarm {

    public static void runServerClient() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                Server server = new Server();
                try {
                    server.runServer(2, Server.PORT);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                Player player = new Player("player1", new LowestColorFirstStrategy());
                new Client().runClient(player, Server.ADDR, Server.PORT);
            }
        }).start();
        Player player = new Player("player2", new LowestColorFirstStrategy());
        new Client().runClient(player, Server.ADDR, Server.PORT);
    }

    public static void main(final String[] args) {
        runServerClient();
    }
}
